<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt"  uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <!--公共样式-->
    <link href="${pageContext.request.contextPath }/web/css/font/iconfont.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/web/css/NormalizeFile.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/web/css/public.css" />
    <!--首页私有样式-->
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/web/css/subpage/index.css" />
    <%-- <link href="${pageContext.request.contextPath }/h-ui/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" /> --%>
    <script type="text/javascript">
    function exit(){
		layer.confirm('<spring:message code="head.confirmExit"></spring:message>', {
			  btn: ['<spring:message code="reciveAddress.confirm"></spring:message>','<spring:message code="reciveAddress.cancel"></spring:message>'], //按钮
			  title:'<spring:message code="reciveAddress.message"></spring:message>'
			}, function(){
				window.location.href="${pageContext.request.contextPath }/web/member/login?state=0";
			}, function(){
				
			});
    }
    //跳转购物车
    function myCart(){
    	$.ajax({  
    		type : "POST",  
             url : "${pageContext.request.contextPath }/web/member/isLogin",
             success: function(data) {
            	 if(data){
            		 window.location.href="${pageContext.request.contextPath }/member/member/shoppingCart-4/index";
            	 }else{
            		 var href ="${pageContext.request.contextPath }/web/member/login?redirectUrl=" + encodeURIComponent("${pageContext.request.contextPath }/member/member/shoppingCart-4/index");
            		 
            		 layer.confirm('<spring:message code="head.notLogin"></spring:message>', {
           			  btn: ['<spring:message code="reciveAddress.confirm"></spring:message>','<spring:message code="reciveAddress.cancel"></spring:message>'], //按钮
           			  title:'<spring:message code="reciveAddress.message"></spring:message>'
           			}, function(){
           				location.href = href;
           			}, function(){
           				
           			});
            		 
            	 }
             }
    	});
    }
    //试衣间
    function fittingRoom(){
    	$.ajax({  
    		type : "POST",  
             url : "${pageContext.request.contextPath }/web/member/isLogin",
             success: function(data) {
            	 if(data){
            		 window.location.href="${pageContext.request.contextPath }/web/pattern/goFittingRoom";
            	 }else{
            		 var href ="${pageContext.request.contextPath }/web/member/login?redirectUrl=" + encodeURIComponent("${pageContext.request.contextPath }/web/pattern/goFittingRoom");
            		 
            		 layer.confirm('<spring:message code="head.notLogin"></spring:message>', {
           			  btn: ['<spring:message code="reciveAddress.confirm"></spring:message>','<spring:message code="reciveAddress.cancel"></spring:message>'], //按钮
           			  title:'<spring:message code="reciveAddress.message"></spring:message>'
           			}, function(){
           				location.href = href;
           			}, function(){
           				
           			});
            		 
            	 }
             }
    	});
    }
    </script>
</head>
<body class="min-w-1260" onload="uploadSingleImg('${pageContext.request.contextPath }/upload/upload')" >
<div class="pagetitle"><spring:message code="head.homePage"></spring:message></div>
<!--header begin-->
<div class="header">
    <div class="contenter header-top">
        <div class="header-left">
            <div class="header-logo-left">
                <img class="" src="${pageContext.request.contextPath }/web/img/logo.png">
            </div>
            <div class="header-logo-right"><p><spring:message code="fashion"></spring:message></p><p>
            <spring:message code="material"></spring:message>
         	</p></div>
            <div class="clearfix"></div>
        </div>
        <div class="header-right">
            <span><a href="javascript:void(0);" onclick="myCart();" onfocus="blur()"><spring:message code="shoppingCart"></spring:message></a></span>
            <span>
            <% if (request.getSession().getAttribute("telphone")==null||request.getSession().getAttribute("telphone")==""){%>   
            <a href="${pageContext.request.contextPath }/web/member/login" onfocus="blur()"><spring:message code="login2"></spring:message></a>|
            <a href="${pageContext.request.contextPath }/web/member/register" onfocus="blur()"><spring:message code="registered"></spring:message></a>
            <%}else{%>
            <a class="log" href="${pageContext.request.contextPath }/member/member/memberInfomation-0/index">
            ${member.mNickname }
            </a>
                <a class="log" onclick="exit();" href="#"><spring:message code="exit"></spring:message></a>
            <%}%> 
            </span>
            <span><a href="javascript:void(0);" onclick="changeLanguage('${pageContext.request.contextPath }/web/main/changeLanguage','zh_cn')">中文</a>|
            <a href="javascript:void(0);" onclick="changeLanguage('${pageContext.request.contextPath }/web/main/changeLanguage','en')">English</a></span>
        </div>
        <div class="clearfix"></div>
    </div>
    <hr />
    <div class="contenter" style="margin-top:5px;">
        <ul class="nav">
            <li><a href="${pageContext.request.contextPath }/web/main/index" onfocus="blur()"> <spring:message code="homePage"></spring:message></a></li>
            <li>
            	<a href="javascript:void(0);" onfocus="blur()"><spring:message code="pattern"></spring:message></a>
            	<ul class="sub-nav">
                    <li><a href="${pageContext.request.contextPath }/web/pattern/flowerTypeCatalog" onfocus="blur()"><spring:message code="patternDirectory"></spring:message></a></li>
                    <li><a href="${pageContext.request.contextPath }/web/theme/main" onfocus="blur()"><spring:message code="subjectClassification"></spring:message></a></li>
                    <li><a href="${pageContext.request.contextPath }/web/show/showFieldList" onfocus="blur()"><spring:message code="showTime"></spring:message></a></li>
                </ul>
            </li>
            <li>
                <a href="javascript:void(0);" onfocus="blur()"><spring:message code="fabric"></spring:message></a>
                <ul class="sub-nav">
                    <li><a href="${pageContext.request.contextPath }/web/fabric/catalog/all" onfocus="blur()"><spring:message code="fabricCatalogue"></spring:message></a></li>
                    <li><a href="${pageContext.request.contextPath }/web/fabric/cloth/all" onfocus="blur()"><spring:message code="version"></spring:message></a></li>
                    <li><a href="${pageContext.request.contextPath }/web/fabric/sample/all" onfocus="blur()"><spring:message code="developmentSamples"></spring:message></a></li>
                </ul>
            </li>
            <li><a href="javascript:void(0);" onclick="fittingRoom();" onfocus="blur()"><spring:message code="fittingRoom"></spring:message></a></li>
            <li><a href="${pageContext.request.contextPath }/web/information/informationList" onfocus="blur()"><spring:message code="information"></spring:message></a></li>
        </ul>
        <!--以图搜图 begin-->
        <div class="search-bar swipe-search">
            <div class="out-search f-l">
                <div class="searchbox-wrap-img" id="serpic">
                    <div class="searchbox-box-img"><img id="preview" alt="" name="pic"></div>
                    <span class="serimg-close" id="serimg-close">X</span>
                </div>
                <form action="javascript:void(0);" method="post" id="formSearch">
                    <input id="imgData" name="fileImg" value="" type="hidden">
                    <input class="search-bar-input search-bar-input2 f-l" placeholder="<spring:message code="patternSearch"></spring:message>" autocomplete="off" name="key" id="key" value="${param.key }" type="text">   
                    <div id="filePicker"></div>
                    <i class="Hui-iconfont search-btn f-l" onclick="search()"></i>
                </form>
                <!-- <i class="Hui-iconfont del2" onclick="shanchubottom()"></i> -->
            </div>
            <a id="photograph" class="photograph f-l" href="#">
                <i class="Hui-iconfont"></i>
                <spring:message code="takePhotos"></spring:message>
            </a>
            <div class="clearfix"></div>
        </div>
        <!--以图搜图 end-->
        <div class="clearfix"></div>
    </div>
</div>
<!--header end-->
<!--全局-->
<script type="text/javascript" src="${pageContext.request.contextPath }/web/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/web/js/public.js"></script>
<!--ie789下placeholder不兼容-->
<script type="text/javascript" src="${pageContext.request.contextPath }/web/js/placeholder.js"></script>
<!--获取中文首字母的函数，需要jQuery支持-->
<script src="${pageContext.request.contextPath }/web/js/jquery.charfirst.pinyin.js" type="text/javascript"></script>
<!--ListNav是一个用于创建按字母顺序分类导航的jQuery插件。-->
<script src="${pageContext.request.contextPath }/web/js/jquery.listnav.min-2.1.js" type="text/javascript"></script>
<!--虚拟滚动条jquery插件-->
<script type="text/javascript" src="${pageContext.request.contextPath }/web/js/jquery.slimscroll.js"></script>
<!-- webuploader图片上传控件 -->
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/lib/webuploader/0.1.5/webuploader.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/web/js/uploadSingleImg.js"></script>
<!--index页面私有js-->
<script type="text/javascript">

	$(document).ready(function(){
		//任凯伟 添加 
		$(document).ajaxComplete(function(event, request, settings) {
			var loginStatus = request.getResponseHeader("loginStatus");
			if (loginStatus == "accessDenied") {
				redirectLogin(location.href, "<spring:message code="head.notLogin"></spring:message>");
			} 
		});
		
		$('#photograph').click(function(){
			$('.webuploader-element-invisible').trigger('click');
		});
		
		initPreviewImg();
		
		setTimeout('initWebuploaderCss()',100);
		
		
		
	});
	
	function initPreviewImg(){
		//返回的以图搜图base64位码
		var fileImg='${fileImg}';
		if(fileImg!=null&&fileImg!=''){
			$('#preview').attr( 'src', 'data:image/jpeg;base64,'+fileImg );
	        $("#serpic").show();
	        $("#serimg-close").click(function(){
				 $("#preview").removeAttr("src");
				 var imageDataMy="";
				 $(this).parent().hide();
				 $("#key").css("padding-left","5px");
			 });
			 $("#key").css("padding-left","49px");
		}
	}
	
	function initWebuploaderCss(){
		$('.webuploader-element-invisible').hide();
		$('#filePicker').hide();
	}
	
	// 跳转登录
	function redirectLogin(redirectUrl, message) {
		var href ="/bdyz/web/member/login";
		if (redirectUrl != null) {
			href += "?redirectUrl=" + encodeURIComponent(redirectUrl);
		}
		if (message != null) {
			
			layer.confirm(message, {
        	  btn: ['<spring:message code="flowertypecatalog.agreed"></spring:message>','<spring:message code="flowertypecatalog.unagree"></spring:message>'], //按钮
        	  title:'<spring:message code="flowertypecatalog.message"></spring:message>'
        	}, function(index){
        		location.href = href;
        	},function(index){
        		
        	});
			
		} else {
			location.href = href;
		}
	}

	function changeLanguage(baseUrl,language){
		$.ajax({
			async:false,
			url:baseUrl,
			type:'post',
			data:{'language':language},
			success:function(result){
				var status=result.msg.status;
				if(status==0){
					location.reload();
				}
			}
		});
	}
	
	/* 图片搜索 */
    function search()
    {  	 
 		 var imageDataMy="";
 		 imageDataMy=$("#preview").attr("src");    	
	  	 $("#imgData").val(imageDataMy);   
	  	 if( $("#imgData").val()!="")
	  	 {    
	  		 $("#formSearch").attr('action','${pageContext.request.contextPath }/web/patternfilter/flowertypecatalog1');
	  		 $("#formSearch").submit();
	  	 }
	  	 else
	  	 {   		
	  		 if($("#key").val()!="")
	  		 {    
	  			 $("#formSearch").attr('action','${pageContext.request.contextPath }/web/patternfilter/flowertypecatalog1');
	  			 $("#formSearch").submit();
	  		 }   
	  		 else
	  		 {
	  			 layer.msg('<spring:message code="head.enterSearchKeyword"></spring:message>',{icon:0,time:1000});
	  			 return false;
	  		 }
	  	 }    	
    }
	
</script>
</body>
</html>